package org.sdfc.model.attr.docbase

import org.sdfc.model.attr.Attribute

/** Attribute implementation for materializing the physical model from a Docbase.
 *  <p>
 *  Instances from DocbaseAttribute subclasses are meant to be declared as constants.
 */
abstract class DocbaseAttribute[+T] (
  /** Name of the DocbaseAttribute. */
  final val name : String,
  /** Name of the Documentum type declaring the DocbaseAttribute. */
  final val typeName : String
)
extends Attribute[T] {
  
  final override def equals(that : Any) : Boolean =
    that match {
      case d : DocbaseAttribute[_] => d.name == name && d.typeName == typeName && d.attrType == attrType
      case _ => false
    }
  
  final override def hashCode : Int = name.hashCode + 41 * ( typeName.hashCode + 41 * attrType.hashCode )
  
}
